import unittest
import time
from fuzzywuzzy import fuzz

from pb.comfuc import Comfuc


class MyTestCase(unittest.TestCase):
    def test1(self):
        print('1740155400000')
        print(int(time.time()*1000))

    def test2(self):
        data = ['1\n','2\n','3\n']
        print(''.join(data))

    def test3(self):
        print(2>3>0)


    def test4(self):
        from datetime import datetime
        now = datetime.now()
        today_zero_time = now.replace(hour=0, minute=0, second=0, microsecond=0)
        timestamp = int(today_zero_time.timestamp() * 1000)
        print(timestamp)

    def test5(self):
        str = 'Home A'
        print(str.split(' '))

    def test6(self):
        t1 = int(round(time.time() * 1000))
        t2 = int(round((time.time() - 21.659) * 1000))
        print(t1)
        print(t2)

    def test7(self):
        t1=time.time()
        time.sleep(2)
        t2=time.time()
        print(t2-t1)


    def test8(self):
        from utils.strategy import Strategy
        y = Strategy.calculate_x(12)
        print(y)
    def test9(self):
        from datetime import datetime
        from datetime import datetime, timedelta
        import pytz

        date_str = "04-14 01:00p"
        current_year = datetime.now().year  # 获取当前年份

        # 处理不规范的 AM/PM 缩写
        date_str = date_str.replace("p", "PM").replace("a", "AM")

        # 解析为 naive datetime 对象
        date_obj = datetime.strptime(date_str, "%m-%d %I:%M%p").replace(year=current_year)

        # 设置年份并转换为 UTC 时区
        utc_minus_4 = pytz.timezone('Etc/GMT+4')  # 注意：pytz的命名规则为 GMT+X 表示 UTC-X
        date_obj_utc4 = date_obj.replace(year=current_year).replace(tzinfo=utc_minus_4)

        # 计算13位时间戳（毫秒）
        timestamp = int(date_obj_utc4.timestamp() * 1000)

        print(timestamp)
        print(timestamp)